﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Manger_Courses : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

            HttpCookie ck = Request.Cookies["major"];
            if (ck != null)
            {
                string sMajorID = ck.Values["majorid"];
                SqlDataSource1.SelectParameters.Clear();
                SqlDataSource1.SelectParameters.Add("Course_MajorID",sMajorID);
                SqlDataSource1.InsertParameters.Add("Course_MajorID",sMajorID);
            }
            else
            {
                FormsAuthentication.SignOut();
                FormsAuthentication.RedirectToLoginPage();
            } 
            
        
    }
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Insert")
        {
            GridView1.DataSourceID = "";
            GridView1.DataBind();
        }
    }
    protected void DetailsView1_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
    {
        GridView1.DataSourceID = "SqlDataSource1";
        GridView1.DataBind();
    }
}
